<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#import "/layout/select.ftl" as my/>
<#assign css>
<#--此ftl中用到的css-->
</#assign>
<#assign js>
<#--此ftl中用到的js-->
<script>
	$(".btn-submit").click(function () {
		// 校验表单合法
		var bootstrapValidator = $(".form-edit").data('bootstrapValidator');
		bootstrapValidator.validate();
		if(bootstrapValidator.isValid()){
			$.ajax({
				type: "POST",
				url: "/sysParam/edit",
				data: $(".form-edit").serialize(),
				dataType: "JSON",
				success: function(res){
					layer.msg(res.message, {time: 2000
					}, function(){
						location.href="/sysParam/index";
					});
				}
			});
		}else{
			return false;
		}
	});

	$('.form-edit').bootstrapValidator({
		message: '请输入有效值',
		feedbackIcons: {
			valid: 'glyphicon glyphicon-ok',
			invalid: 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
		}
	});

</script>
</#assign>
<@layout title="编辑" active="sysParam">
<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>
		<#if isAdd>
            新增
        <#else>
            编辑
        </#if>
		<small>参数维护详细信息</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="/"><i class="fa fa-home"></i> 管理后台</a></li>
		<li><a href="#"><i class="fa fa-list-ul"></i> 参数维护管理</a></li>
		<li class="active"><i class="fa fa-edit"></i>
		    <#if isAdd>
                新增
            <#else>
                编辑
            </#if>
		</li>
	</ol>
</section>
<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<!-- Default box -->
			<div class="box  box-primary">
				<form class="form-horizontal form-edit" method="post" action="sysParam/edit">
					<div class="box-body">
						<input type="hidden" id="id" name="id" value="${sysParam.id!}">
						<input type="hidden" id="isAdd" name="isAdd" value="${isAdd?string('true','false')}">

						<div class="form-group">
							<label class="col-sm-2 control-label">参数名称：</label>
							<div class="col-sm-10">
								<label class="control-label">${sysParam.note!}</label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">参数值：</label>
							<div class="col-sm-10">
								<#if sysParam.value=='ON' || sysParam.value == 'OFF'>
									<select name="value" class="form-control">
										<option value="ON" <#if sysParam.value=='ON' ></#if>>是</option>
                                        <option value="OFF" <#if sysParam.value=='OFF' ></#if>>否</option>
									</select>
								<#else >
									<input required placeholder="请输入参数值" id="value" name="value" class="form-control" type="text" value="${sysParam.value!}" >
                                    <#if sysParam.name == 'CANCEL_ORDER_OPTION'>
                                        <label style="font-size: 13px;color: red">多个值使用逗号分隔，如：值a,值b,值c</label>
                                    </#if>
                                </#if>
							</div>
						</div>

					<div class="box-footer">
						<button type="button" class="btn btn-default btn-back">返回</button>
						<button type="button" class="btn btn-info pull-right btn-submit">提交</button>
					</div>

				</form>
			</div>
			<!-- /.box -->
		</div>
	</div>
</section>
<!-- /.content -->
</@layout>
